<template>
  <div class="add-major">
    <el-form ref="form" :model="formData" label-width="150px">
      <el-form-item label="类型选择:" required>
        <el-radio-group v-model="formData.is_postgraduate" @change="changeType">
          <el-radio :value='1'>硕士</el-radio>
          <el-radio :value='0'>本科</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item v-if="showItem" label="是否接受高考分数:" required>
        <el-radio-group v-model="radioNEMT">
          <el-radio :value="0">否</el-radio>
          <el-radio :value="1">是</el-radio>
        </el-radio-group>
        <el-input-number v-if="radioNEMT == 1" v-model="formData.NEMT" :min="0" style="margin-left: 15px;width: 200px;" placeholder="请输入高考分数"></el-input-number>
      </el-form-item>
      <el-form-item label="是否为预科课程:" required>
        <el-radio-group v-model="foundationCourse">
          <el-radio :value='0'>否</el-radio>
          <el-radio :value='1'>是</el-radio>
        </el-radio-group>
      </el-form-item>
      <div style="display: flex">
        <el-form-item v-if="foundationCourse == 1" :label="formData.is_postgraduate == 1 ? '录取要求平均分' : '高中平均分'" required>
          <el-input-number v-if="formData.is_postgraduate == 1" v-model="formData.average_score" :precision="1" :step="0.1" :min="0" style="width: 230px;" placeholder="请输入录取要求平均分"></el-input-number>
          <el-input v-else v-model="formData.average_score" style="width: 230px;" placeholder="请输入高中平均分"></el-input>
        </el-form-item>
        <el-form-item v-if="foundationCourse == 1 && formData.is_postgraduate === 0" label="最低入学年级" required>
          <el-input v-model="formData.minimum_entry_grade" style="width: 200px;" placeholder="请输入最低入学年级"></el-input>
        </el-form-item>
      </div>
      <el-form-item label="可衔接课程:" v-if="foundationCourse === 1">
        <el-input v-model="formData.bridging_course" placeholder="请输入可衔接课程"></el-input>
      </el-form-item>
      <el-form-item label="专业名称:" required>
        <el-input v-model="formData.name_zh" placeholder="请输入专业名称"></el-input>
      </el-form-item>
      <el-form-item label="专业英文名称:" required>
        <el-input v-model="formData.name" placeholder="请输入专业英文名称"></el-input>
      </el-form-item>
      <el-form-item label="专业介绍:">
        <el-input type="textarea" :rows="2" v-model="formData.intro" placeholder="请输入专业介绍"></el-input>
      </el-form-item>
      <el-form-item label="背景要求:" required>
        <el-input type="textarea" :rows="2" v-model="formData.background" placeholder="请输入背景要求"></el-input>
      </el-form-item>
      <el-form-item label="入学月份:" required>
        <el-select multiple v-model="entrance_month" placeholder="请选择学校入学月份">
          <el-option label="一月" :value="1"></el-option>
          <el-option label="二月" :value="2"></el-option>
          <el-option label="三月" :value="3"></el-option>
          <el-option label="四月" :value="4"></el-option>
          <el-option label="五月" :value="5"></el-option>
          <el-option label="六月" :value="6"></el-option>
          <el-option label="七月" :value="7"></el-option>
          <el-option label="八月" :value="8"></el-option>
          <el-option label="九月" :value="9"></el-option>
          <el-option label="十月" :value="10"></el-option>
          <el-option label="十一月" :value="11"></el-option>
          <el-option label="十二月" :value="12"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="学费:" required>
        <el-input v-model="formData.fee" placeholder="请输入学费"></el-input>
        <span class="add-major-unit" v-if="!state.currencyData.has_multiple">{{ state.currencyData.details[0].name }}</span>
        <el-select style="width: 90px;position: absolute;right: 0;" v-else v-model="formData.currency_code">
          <el-option v-for="item in state.currencyData.details" :key="item.currency_code" :label="item.name" :value="item.currency_code"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="标签:" required>
        <el-cascader
          style="width: 100%;"
          v-model="formData.tags"
          :options="state.tagsList"
          @change="changeTagsList"
          :props="tagsProps"
          collapse-tags></el-cascader>
      </el-form-item>
      <!-- <el-form-item v-if="!showItem && foundationCourse == 0" label="接收的国内大学:">
        <div class="add-major-button">
          <div style="display: flex;width: 80%;">
            <el-button type="primary" plain @click="chooseSchool">点击选择国内大学</el-button>
            <el-button type="warning" @click="batchImport">批量导入</el-button>
            <el-select v-model="configTemplateValue" @change="changeTemplate" clearable placeholder="请选择已配置的模板" style="width: 50%;margin-left: 12px;">
              <el-option v-for="item in state.templateOptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
            </el-select>
          </div>
          <el-button v-if="state.collegesListDate.length > 0" type="danger" plain @click="batchDeletion">批量删除</el-button>
        </div>
        <el-table :data="state.collegesTableData" v-loading="loadingTable" @selection-change="handleSelectionChange" v-if="state.collegesListDate.length > 0" border style="width: 100%">
          <el-table-column type="selection" width="55" />
          <el-table-column type="index" align="center" width="60" label="序号"></el-table-column>
          <el-table-column prop="name" align="center" label="学校名称"> </el-table-column>
          <el-table-column prop="" align="center" :label="typeName" width="140">
            <template #default="scope">
              <el-input-number style="width: 100%;" v-model="scope.row.GPA"  :min="0" :label="'输入'+ typeName" ></el-input-number>
            </template>
          </el-table-column>
          <el-table-column align="center" label="操作" width="100">
            <template #default="scope">
              <el-button type="danger" style="width: 50px;height: 25px;" plain @click="deleteSchoolRow(scope.$index,state.collegesTableData)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-form-item>
      <el-form-item v-if="!showItem && foundationCourse == 0" label="接收国内所有大学:">
        <div class="add-major-checked">
          <el-checkbox @change="changecheckedAll" v-model="checkedAllValue" :label="typeName"></el-checkbox>
          <el-input-number style="width: 40%;" :min="0" v-if="checkedAllValue" v-model="checkedValue" :placeholder="'请输入' + typeName"></el-input-number>
        </div>
      </el-form-item> -->
      <el-form-item label="学制:">
        <el-input v-model="formData.len_schooling" placeholder="请输入学制"></el-input>
        <span class="add-major-unit">月</span>
      </el-form-item>
      <el-form-item v-if="props.parmas.itemInfo.areas_id == 1 && !showItem" label="英国学位:">
        <el-select v-model="formData.uk_rank" placeholder="请选择英国学位">
          <el-option label="一等" :value="1"></el-option>
          <el-option label="二等一" :value="2"></el-option>
          <el-option label="有条件二等二" :value="3"></el-option>
          <el-option label="二等二" :value="4"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item v-if="!showItem" label="工作经验:">
        <el-input v-model="formData.experience" placeholder="请输入工作经验"></el-input>
        <!-- <span class="add-major-unit">年</span> -->
      </el-form-item>
      <el-form-item label="面/笔试要求:">
        <el-input type="textarea" :rows="2" v-model="formData.interview_written_test" placeholder="请输入面/笔试要求"></el-input>
      </el-form-item>
      <el-form-item label="雅思小分要求:">
        <el-input v-model="formData.IELTS" placeholder="请输入雅思小分要求"></el-input>
      </el-form-item>
      <el-form-item label="雅思总分:">
        <el-input-number v-model="formData.IELTS_TOTAL" :precision="1" :step="0.1" :min="0" style="width: 200px;" placeholder="请输入雅思总分"></el-input-number>
      </el-form-item>
      <el-form-item label="托福要求:">
        <el-input v-model="formData.TOEFL" placeholder="请输入托福要求"></el-input>
      </el-form-item>
      <el-form-item label="多邻国:">
        <el-input v-model="formData.multi_neighbors" placeholder="请输入多邻国"></el-input>
      </el-form-item>
      <el-form-item label="语言要求:">
        <el-input v-model="formData.language" placeholder="请输入语言要求"></el-input>
      </el-form-item>
      <el-form-item label="GMAT:">
        <el-input v-model="formData.GMAT" placeholder="请输入GMAT"></el-input>
      </el-form-item>
      <el-form-item label="GRE:">
        <el-input v-model="formData.GRE" placeholder="请输入GRE"></el-input>
      </el-form-item>
      <el-form-item label="PTE:">
        <el-input v-model="formData.PTE" placeholder="请输入PTE"></el-input>
      </el-form-item>
      <el-form-item label="作品集:">
        <el-input type="textarea" :rows="2" v-model="formData.works" placeholder="请输入作品集"></el-input>
      </el-form-item>
      <el-form-item label="细分方向:">
        <el-input type="textarea" :rows="2" v-model="formData.special" placeholder="请输入细分方向"></el-input>
      </el-form-item>
      <el-form-item label="入学时间:">
        <el-table border :data="state.timeTableData" style="width: 100%">
          <el-table-column label="入学月份" width="110" align="center">
            <template #default="scope">
              <el-input style="width: 100%;" clearable v-model="scope.row.month" placeholder="输入月份" ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="申请开始时间" align="center">
            <template #default="scope">
              <el-input style="width: 100%;" clearable v-model="scope.row.startTime" placeholder="输入开始时间" ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="申请截止时间" align="center">
            <template #default="scope">
              <el-input style="width: 100%;" clearable v-model="scope.row.endTime" placeholder="输入截止时间" ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="操作" width="100" align="center">
            <template #default="scope">
              <span class="add-major-add" @click.prevent="addRow(scope.$index, state.timeTableData)">增加</span>
              <span class="add-major-del" @click.prevent="deleteRow(scope.$index, state.timeTableData)">移除</span>
            </template>
          </el-table-column>
        </el-table>
      </el-form-item>
      <el-form-item label="备注:">
        <el-input type="textarea" :rows="2" v-model="formData.note" placeholder="请输入备注信息"></el-input>
      </el-form-item>
      <el-form-item label="专业链接:">
        <el-input v-model="formData.link" placeholder="请输入专业链接"></el-input>
      </el-form-item>
      <el-form-item label="接收GPA最低分:">
        <el-input-number style="width: 50%;" v-model="formData.gpa_min" :min="0" placeholder="请输入接收GPA最低分"></el-input-number>
      </el-form-item>
      <el-form-item label="接收GPA最高分:">
        <el-input-number style="width: 50%;" v-model="formData.gpa_max" :min="0" placeholder="请输入接收GPA最高分"></el-input-number>
      </el-form-item>
    </el-form>
    <div>
      <el-button @click="onsubmit(0)">取消</el-button>
      <el-button type="primary" @click="onsubmit(1)" element-loading-text="数据提交中请稍等..."  v-loading.fullscreen.lock="majorloading">确定</el-button>
    </div>
    <!-- 1.选择国内大学弹窗 -->
    <el-dialog
      width="35%"
      title="学校列表"
      :close-on-click-modal="false"
      @close="closeDialog"
      v-model="innerVisible"
      append-to-body>
      <div @scroll="handleScroll" class="add-major-school" id="content">
        <el-input :disabled='schoolSearchDisable' @keyup.enter="searchSchool" v-model="schoolSearchName" clearable placeholder="请输入要搜索的学校名称" class="input-with-select">
          <template #prepend>
            <el-select :disabled='schoolSearchDisable' v-model="pageInfo.extra" @change="changeExtra" style="width: 100px;padding: 0;" multiple placeholder="类型选择">
              <el-option label="985" :value="985"></el-option>
              <el-option label="211" :value="211"></el-option>
              <el-option label="双非" value="n92"></el-option>
            </el-select>
          </template>
          <template #append>
            <el-button :disabled='schoolSearchDisable' class="input-with-button" @click="searchSchool">搜索</el-button>
          </template>
        </el-input>
        <div style="margin-top:5px;display: flex;align-items: center;" v-if="(schoolSearchName === 'n92' || isShowPage) && !schoolSearchDisable">
          <el-radio-group v-model="pageInfo.limit">
            <el-radio-button label="20" :value="20"></el-radio-button>
            <el-radio-button label="40" :value="40" ></el-radio-button>
            <el-radio-button label="60" :value="60"></el-radio-button>
            <el-radio-button label="80" :value="80"></el-radio-button>
            <el-radio-button label="100" :value="100"></el-radio-button>
            <el-radio-button label="200" :value="200"></el-radio-button>
          </el-radio-group>
          <span style="margin-left:5px">条</span>
        </div>
        <div v-if="state.optionsCollegesList.length < 1" class="add-major-title">
          <p class="major-title1">系统支持以下搜索模式：</p>
          <p>1、根据大学类型进行搜索，比如点击顶部<span class="major-title2">“类型选择”</span>下拉框的<span class="major-title2">“985”</span>，可以搜索出“北京大学”等985大学；点击<span class="major-title2">“211”</span>，可以搜索出“北京理工大学”等211大学；点击<span class="major-title2">“双非”</span>，可以搜索出“三亚学院”、“三亚大学”等“双非”大学（因“双非”学校数量大，为方便您筛选，系统对“双非”学校进行分页展示，每页可展示20/40/60/80/100/200所学校）。</p>
          <p>2、根据中文名称模糊搜索，比如输入<span class="major-title2">“科技”</span>两个字，可以搜索出“安徽科技学院”、“北京电子科技学院”等包含“科技”两个字的大学（如果选择了某个大学类型，比如985，则搜索出包含“科技”两个字的985大学）。</p>
          <p>3、根据拼音缩写字母进行搜索，比如输入<span class="major-title2">“sc”</span>两个字母，可以搜索出“四川外国语大学成都学院”、“四川农业大学”等以“sc”名称拼音缩写开头的大学（如果选择了某个大学类型，比如985，则搜索出以“sc”名称拼音缩写开头的985大学）。</p>
        </div>
        <div v-if="state.optionsCollegesList.length > 0">
          <div style="font-size:13px;margin-top:5px;color:rgb(230, 162, 60)">如果要搜索其他学校,请取消已选中的学校再进行搜索哦</div>
          <div>
            <div class="add-major-gpa" v-if="isSreach">
              <el-input-number :min="0" v-model="defaultValue" :placeholder="'请输入默认' + typeName"></el-input-number>
              <el-button type="primary" @click="makeSureSchoolGPA()">确定</el-button>
              <span class="major-gpa-title">点·确定·批量设置{{typeName}}</span>
            </div>
            <div class="add-major-allcheckbox">
              <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
              <div>共{{state.optionsCollegesList.length}}条</div>
            </div>
          </div>
          <el-checkbox-group class="checkbox-view" v-model="state.collegesListDate" @change="changeSelectCollegesList">
            <div v-for="item in state.optionsCollegesList" :key="item.id">
              <el-checkbox :disabled="item.isDisabled" :label="item.name" :value="item.id"></el-checkbox>
            </div>
          </el-checkbox-group>
        </div>
      </div>
      <!-- <div v-if="state.optionsCollegesList.length > 0" style="text-align: center;margin-top: 10px">
        <el-button type="primary" @click="makeSureSchool">确定</el-button>
      </div> -->
    </el-dialog>
    <!--2.批量导入  -->
    <el-dialog
      width="20%"
      title="请选择Excel文件导入大学数据"
      :close-on-click-modal="false"
      v-model="batchCollegesVisible">
      <div v-if="batchCollegesVisible" v-loading="batchloading" element-loading-text="正在导入,请稍等..." style="margin-top: 15px;">
        <div class="view-main-table-upload">
          <input type="file" @change="handleFileChange" accept=".xlsx, .xls">
        </div>
        <el-button type="primary" @click="uploadFile">提交</el-button>
      </div>
    </el-dialog>
    <!-- 错误数据提示 -->
    <el-dialog
      width="390"
      style="text-align: start;"
      title="提示"
      :close-on-click-modal="false"
      v-model="errorMessageVisible">
      <div v-if="errorMessageVisible" style="line-height: 23px;">
        <div>您有<span style="color: red;font-weight: 600;"> {{failList.length}} </span>条数据(见下表)导入失败,请确认大学名称或GPA分数填写是否正确:</div>
        <div v-for="(item,index) of failList" :key="index">
          <div style="margin-left: 100px;color: red;">{{item}}</div>
        </div>
      </div>
      <div style="text-align: end;margin-top: 15px;"><el-button type="primary" @click="errorMessageVisible = false">确 定</el-button></div>
    </el-dialog>
  </div>
</template>

<script setup>
import { ref,reactive,computed,onMounted, h } from 'vue';
import { ElMessage ,ElLoading } from 'element-plus';
import API from "@/utils/api";
import { defineProps, defineEmits } from 'vue';
import { serverUrl } from '@/utils/const'
import axios from 'axios';
import router from "@/router/index";

let formData  = reactive({ 
  tags:[],  //标签
  apply_time:[], //申请时间
  is_postgraduate:1,   //硕士
  NEMT:null,
  entrance_month:''
});
let entrance_month = ref([])
let typeName = ref('GPA')
function changeType (val) {
  showItem.value = val === 1 ? false : true
  if(val === 0) {
    radioNEMT.value = 0
  }
  foundationCourse.value = 0
  formData.average_score = null
  formData.minimum_entry_grade = null
  formData.bridging_course = null
}
let configTemplateValue = ref(null)
let checkedValue = ref(0) //选中所有国内学校的GPA
let checkedAllValue = ref(false)
let loading = ref(false)
let defaultValue = ref()
let defaultStatus = ref(false)
let innerVisible = ref(false)
let innerVisible2 = ref(false)
let isSreach = ref(false)
let schoolSearchName = ref()
let schoolSearchDisable = ref(false)
let isIndeterminate = ref(true)
let checkAll = ref(false)
let loadingTable = ref(false)
let isShowPage = ref(false)
let radioNEMT = ref(0)
let showItem = ref(false)
let foundationCourse = ref(0)
let pageInfo = reactive({
  limit:null,
  currentPage:1,
  pageTotal:0,
  totalNumber:null,
  extra:[],
})
let state = reactive({
  areaList: [],
  fileList:[],
  tagsList:[],
  optionsCollegesList:[],
  collegesTableData:[],
  timeTableData:[{month:null,startTime:null,endTime:null}],
  collegesListDate:[],
  cloneCollegesList:[],
  selectSchoolList:[],  //选中的学校数据
  optionsCollegesList_:[],   //搜索出来的数据
  list1:[],
  allList:[],
  handleSelectList:[],    //选中批量删除的数据
  currencyData:{
    details:[{currency_code:null,name:null}],
    has_multiple:null
  },    //货币数据
  templateOptions:[],   //模板选项框列表
});
const props = defineProps({
  parmas: Object,
});
// console.log(props.parmas,'parmas');
const tagsProps = ref({
  multiple: true,
  value: 'id',
  label: 'name',
  children:'children'
})
const changeTagsList = ((value) => {
  // console.log(JSON.parse(JSON.stringify(value)),'value');
})
// 获取标签数据
function gettagsList () {
  API.majorList.getTagsList({}, (res) => {
    if(res.code == 0) {
      state.tagsList = res.data
    }
  })
}
// 点击全选按钮
function handleCheckAllChange(val) {
  // console.log(checkAll.value ,'val');
  let list = []
  state.optionsCollegesList.forEach((item) => {
    list.push(item.id)
  })
  if(!val) {
    var newArray = state.collegesListDate.filter(function(item) {
        return list.indexOf(item) === -1;
    });
    state.collegesListDate = newArray
    schoolSearchDisable.value = false
  }else {
    var newArray = list.concat(state.collegesListDate);
    state.collegesListDate = newArray
    schoolSearchDisable.value = true
  }
  state.collegesTableData.forEach((item,index) => {
    if(item.GPA === 0) {
      delete state.collegesTableData[index]
    }
  })
  const tab = state.collegesTableData.filter(item => item !== "" && item !== null && item !== undefined);
  // console.log(state.collegesListDate,'全选按钮处2');
  // console.log(schoolSearchDisable.value,'schoolSearchDisable.value');
  isIndeterminate.value = false
}
// 关闭弹出事件
function closeDialog() {
  checkAll.value = false
  schoolSearchDisable.value = false
  schoolSearchName.value = null
  state.optionsCollegesList = []
  pageInfo.limit = null
  pageInfo.extra = []
  isShowPage.value = false
  state.selectSchoolList.forEach((item,index) => {
    if(item. GPA === 0) {
      delete state.selectSchoolList[index]
    }
  })
  const tab = state.collegesTableData.filter(item => item !== "" && item !== null && item !== undefined);
  const select = state.selectSchoolList.filter(item => item !== "" && item !== null && item !== undefined);
  state.selectSchoolList = select
  state.collegesTableData = tab
  // console.log(state.collegesTableData,'state.collegesTableData');
  // console.log(state.selectSchoolList,'state.selectSchoolList');
}
// 点击选择学校按钮
function chooseSchool() {
  innerVisible.value = !innerVisible.value
  isSreach.value = false
  // getCollegesList ()
}
// 选择类型
function changeExtra(val) {
  if(val.length === 2) {
    delete val[0]
  }
  const list = val.filter(item => item !== "" && item !== null && item !== undefined);
  pageInfo.extra = list
  if (pageInfo.extra.includes('n92')) {
    isShowPage.value = true
  }else {
    isShowPage.value = false
  }
}
/* 获取选项列表 */
// function getDatas(key) {
//   // console.log(key,'key');
//   loading.value = true
//   defaultValue.value = null
//   if(key) {
//     defaultStatus.value = true
//     API.majorList.getCollegesList({name:key || ""}, (res) => {
//       if(res.code == 0) {
//         setInterval(()=> {
//           loading.value = false
//         },1000)
//         state.optionsCollegesList = res.data
//         if(res.data.length > 0) {
//           res.data.forEach(item => {
//             state.collegesListDate.push(item.id)
//           })
//           state.collegesListDate = Array.from(new Set(state.collegesListDate))
//           const currentOptions = state.optionsCollegesList.filter(item => 
//             state.collegesListDate.includes(item.id)
//           );
//           currentOptions.forEach(option => {
//             const existItem = state.collegesTableData.find(item => item.id === option.id);
//             // console.log(existItem,'existItem');
//             if (!existItem) {
//               state.collegesTableData.unshift({
//                 id: option.id,
//                 name: option.name,
//                 GPA:0
//               });
//             }
//           });
//         }
//       }
//     })
//   }else {
//     defaultStatus.value = false
//     getCollegesList()
//     setTimeout(()=>{
//       loading.value = false
//     },1000)
//   }
// }
// 搜索学校数据
function searchSchool() {
  let schoolType = pageInfo.extra.join(',')
  if(schoolSearchName.value || pageInfo.extra.length > 0) {
    schoolSearchDisable.value = true
  }else {
    schoolSearchDisable.value = false
  }
  if(!schoolSearchName.value && pageInfo.extra.length < 1) {
    return ElMessage.warning('请输入关键字或者选择学校类型进行搜索哦')
  }
  if((schoolSearchName.value === 'n92' || schoolType === 'n92') && !pageInfo.limit) {
    schoolSearchDisable.value = false
    return ElMessage.warning('请选择要搜索的条数哦!')
  }
  loading.value = true
  // if(!defaultValue.value && props.parmas.type != 'update') {
  //   let isShow = false
  //   if(state.selectSchoolList.length > 0) {
  //     state.collegesListDate.forEach((item1) => {
  //       state.optionsCollegesList.forEach(item2 => {
  //         if(item1 === item2.id) {
  //           isShow = true
  //         }
  //       })
  //     })
  //   }
  //   if(isShow) {
  //     loading.value = false
  //     return ElMessage.warning('请设置默认值后再搜索其他学校')
  //   }
  // }
  // console.log(state.collegesListDate,'选中的数据');
  let checkList = []
  // console.log(isSreach.value,'isSreach');
  if(state.collegesTableData.length > 0) {
    state.collegesTableData.forEach(item => {
      checkList.push(item.id)
    })
  }
  let exclude_ids_ =  checkList.join(',')
  isSreach.value = true
  defaultValue.value = null
  if(schoolSearchName.value || pageInfo.extra.length > 0) {
    let index = (schoolSearchName.value === 'n92' || schoolType === 'n92') ?  'getCollegesListPage' : 'getCollegesList'
    let parmas = {} 
    if(schoolSearchName.value === 'n92' || schoolType === 'n92') {
      parmas = {
        page:1,
        limit:pageInfo.limit,
        name:schoolSearchName.value,
        exclude_ids:exclude_ids_,
        extra:schoolType,
      }
    }else {
      parmas = {
        name:schoolSearchName.value,
        exclude_ids:exclude_ids_,
        extra:schoolType,
      }
    }
    API.majorList[index](parmas, (res) => {
      if(res.code == 0) {
        loading.value = false
        if(res.data.length > 0) {
          if(schoolSearchName.value === 'n92' || schoolType === 'n92') {
            schoolSearchDisable.value = true
          }
          res.data.forEach(item => {
            state.collegesListDate.push(item.id)
          })
          checkAll.value = true
          isIndeterminate.value = false
          state.optionsCollegesList_ = res.data
          state.optionsCollegesList = res.data
          state.collegesListDate = Array.from(new Set(state.collegesListDate))
          const currentOptions = state.optionsCollegesList.filter(item => 
            state.collegesListDate.includes(item.id)
          );
          // console.log(currentOptions,'currentOptions');
          currentOptions.forEach(option => {
            const existItem = state.selectSchoolList.find(item => item.id === option.id);
            // console.log(existItem,'existItem');
            if (!existItem) {
              state.selectSchoolList.unshift({
                id: option.id,
                name: option.name,
                GPA:0
              });
            }
          });
        }else {
          state.optionsCollegesList = res.data
          schoolSearchDisable.value = false
          ElMessage.warning('无搜索结果或者结果已在列表中无需重复搜索')
        }
        // console.log(state.collegesListDate,'state.collegesListDate走了');
        // console.log(state.selectSchoolList,'state.selectSchoolList走了');
        // state.selectSchoolList.forEach((item) => {
        //   state.optionsCollegesList.forEach(item1 => {
        //     if(item.id === item1.id) {
        //       if(item.GPA >0) {
        //         isSreach.value = false
        //       }else {
        //         isSreach.value = true
        //         defaultValue.value = null
        //       }
        //     }
        //   })
        // })
      }
      // console.log(isSreach.value,'isSreach.value');
    })
  }else {
    // getCollegesList()
    loading.value = false
    isSreach.value = false
    schoolSearchName.value = null
  }
}
// 确认设置默认GPA值
function makeSureSchoolGPA() {
  if(state.collegesTableData.length > 0) {
    if(state.collegesTableData.length == state.collegesListDate.length) {
      return ElMessage.warning(`请先选择学校后在设置默认的${typeName.value}哦`)
    }
  }else {
    if(state.collegesListDate.length < 1) {
      return ElMessage.warning(`请先选择学校后在设置默认的${typeName.value}哦`)
    }
  }
  if(!defaultValue.value) {
    return ElMessage.warning(`默认的${typeName.value}必须大于0哦`)
  }
  // setTimeout(() => {
  //   loadingView.value = true
  // },5000)
  if(defaultValue.value) {
    loading.value = true
    // console.log(state.selectSchoolList,'数据');
    // console.log(state.collegesListDate,'collegesListDate');
    let selectList_ = []
    state.collegesListDate.forEach(item => {
      state.selectSchoolList.forEach((item_,index) => {
        if(item === item_.id) {
          selectList_.push(item_)
        }
      })
    })
    selectList_.forEach(item => {
      if(item.GPA < 1) {
        item.GPA = defaultValue.value
      }
    })
    state.selectSchoolList = selectList_
    // getCollegesList()
    isSreach.value = false
    schoolSearchName.value = null
    schoolSearchDisable.value = false
    schoolSearchDisable.value = false
    const list1 = []
    // console.log(state.collegesListDate,'state.collegesListDate');
    // console.log(state.collegesTableData,'tab');
    state.collegesListDate.forEach(item1 => {
      state.cloneCollegesList.forEach(item3 => {
        if(item1 === item3.id) {
          list1.unshift({
            id: item3.id,
            name: item3.name,
            GPA:0,
          })
        }
      })
    })
    if(list1.length > 0) {
      list1.forEach((item,index) => {
        state.selectSchoolList.forEach(item2 => {
          if(item.id === item2.id && item2.GPA != 0) {
            list1[index].GPA = item2.GPA
          }
        })
      })
    }
    // console.log(list1,'list1');
    const newArray = state.collegesTableData.filter(item => item !== "" && item !== null && item !== undefined);
    // console.log(newArray,'newArray');
    if(newArray.length > 0) {
      newArray.forEach((item,index) => {
        list1.forEach((item1,index1) => {
          if(item.id === item1.id) {
            console.log(1);
            list1[index1].GPA = item.GPA
          }
          if(item1.GPA <= 0) {
            list1[index1].GPA = defaultValue.value
          }
        })
      })
    }else {
      list1.forEach((item,index) => {
        item.GPA = defaultValue.value
      })
    }
    state.collegesTableData = list1
    innerVisible.value = false
    loading.value = false
    // console.log(state.collegesTableData,'表格数据');
    defaultValue.value = null
  }
  schoolSearchDisable.value = false
  pageInfo.limit = null
  pageInfo.extra = []
  isShowPage.value = false
}
// 单条删除
function deleteSchoolRow(index,table) {
  state.collegesListDate = []
  state.collegesTableData.splice(index, 1)
  state.selectSchoolList = state.collegesTableData
  state.collegesTableData.forEach(item => {
    state.collegesListDate.push(item.id)
  })
  const tab = state.collegesTableData.filter(item => item !== "" && item !== null && item !== undefined);
  const select = state.selectSchoolList.filter(item => item !== "" && item !== null && item !== undefined);
  state.selectSchoolList = select
  state.collegesTableData = tab
  // console.log(state.selectSchoolList,'state.selectSchoolList');
  // console.log(state.collegesListDate,'state.collegesListDatet');
  // console.log(state.collegesTableData,'table');
  // console.log(tab,'tab');
}
// 批量删除
function batchDeletion () {
  if(state.handleSelectList.length < 1) {
    return ElMessage.warning('请先勾选要删除的学校哦')
  }else {
    loadingTable.value = true
    state.collegesListDate = []
    state.collegesTableData.forEach((item,index) => {
      state.handleSelectList.forEach((item1) => {
        if(item.id === item1.id) {
          delete state.collegesTableData[index]
        }else {
          state.collegesListDate.push(item.id)
        }
      })
    })
    if(state.collegesTableData.length === state.handleSelectList.length) {
      state.collegesListDate = []
    }
    state.selectSchoolList = state.collegesTableData
    loadingTable.value = false
    // console.log(state.collegesTableData,'state.collegesTableData');
  }
  const tab = state.collegesTableData.filter(item => item !== "" && item !== null && item !== undefined);
  const select = state.selectSchoolList.filter(item => item !== "" && item !== null && item !== undefined);
  state.selectSchoolList = select
  state.collegesTableData = tab
}
// 滚动条最底部请求下页数据
const isLoadingMore = ref(false);
const handleScroll = (event) => {
    // const { scrollTop, scrollHeight, clientHeight } = event.target;
    // // 检查是否滚动到底部
    // if (scrollTop + clientHeight >= scrollHeight && !isLoadingMore.value) {
    //   isLoadingMore.value = true;
    //   console.log('走了');
    //   // 模拟获取下一页数据
    //   setTimeout(() => {
    //     let checkList = []
    //     if(state.collegesTableData.length > 0) {
    //       state.collegesTableData.forEach(item => {
    //         checkList.push(item.id)
    //       })
    //     }
    //     let exclude_ids_ =  checkList.join(',')
    //     API.majorList.getCollegesList({name:schoolSearchName.value,exclude_ids:exclude_ids_}, (res) => {
    //       if(res.code == 0) {
    //         if(res.data.length > 0) {
    //           console.log(state.collegesListDate,'state.collegesListDate');
    //           res.data.forEach(item => {
    //             state.collegesListDate.push(item.id)
    //           })
    //           checkAll.value = true
    //           isIndeterminate.value = false
    //           // state.optionsCollegesList_ = res.data
    //           state.optionsCollegesList.push(res.data)
    //         }
    //       }
    //     })
    //     isLoadingMore.value = false;
    //   }, 1000);
    // }
  };
// 选择批量数据
function handleSelectionChange (val) {
  state.handleSelectList = val
}
// const multiSelect = ref()
// 确认设置默认GPA值
// function makeSureGPA() {
//   if(state.collegesTableData.length < 1) {
//     ElMessage.warning('请先选择学校后在设置默认的GPA哦')
//   }
//   // console.log(state.collegesTableData,'state.collegesTableData');
//   if(defaultValue.value) {
//     state.collegesTableData.forEach(item => {
//       if(!item.GPA) {
//         item.GPA = defaultValue.value
//       }
//     })
//     multiSelect.value.blur()
//   }else {
//     ElMessage.warning('请输入默认的GPA哦')
//   }
// }
// 移除选中的数据
// function removeCollgeTag(val) {
//   state.collegesTableData = state.collegesTableData.filter(item => item.id !== val)
// }
// 选中的学校数据
function changeSelectCollegesList(list) {
  let arr = []
  state.optionsCollegesList.forEach((item) => {
    list.forEach(item1 => {
      if(item.id === item1) {
        arr.push(item1)
      }
    })
  })
  let checkedCount = arr.length
  checkAll.value = checkedCount === state.optionsCollegesList.length
  isIndeterminate.value =  checkedCount > 0 && checkedCount <= state.optionsCollegesList.length
  if(!isIndeterminate.value) {
    schoolSearchDisable.value = false
  }else {
    schoolSearchDisable.value = true
  }

  // console.log(state.optionsCollegesList_,'state.optionsCollegesList_');
  // let Array1 = []
  // state.optionsCollegesList_.forEach((item) => {
  //   Array1.push(item.id)
  // })
  // if(schoolSearchName.value) {
  //   if(!containsAll(list,Array1)) {
  //     isSreach.value = true
  //     defaultStatus.value = null
  //   }else {
  //     isSreach.value = false
  //   }
  // }
}
function containsAll(superset, subset) {
  return subset.some(item => superset.includes(item));
}
// 确定选中的学校数据
function makeSureSchool () {
  // innerVisible2.value = !innerVisible2.value
  // return
  schoolSearchDisable.value = false
  const list1 = []
  state.collegesListDate.forEach(item1 => {
    state.cloneCollegesList.forEach(item3 => {
      if(item1 === item3.id) {
        list1.unshift({
          id: item3.id,
          name: item3.name,
          GPA:0,
        })
      }
    })
  })
  if(list1.length > 0) {
    list1.forEach((item,index) => {
      state.selectSchoolList.forEach(item2 => {
        if(item.id === item2.id && item2.GPA != 0) {
          list1[index].GPA = item2.GPA
        }
      })
    })
  }
  innerVisible.value = false
  state.collegesTableData = list1
}
// 选中数据
// const changeCollegesList = ((list) => {
//   // console.log(list,'选中');
//   const selectList = list;
//   state.optionsCollegesList.forEach(item1 => {
//     const match = selectList.find(item2 => item2 === item1.id);
//     if (match) {
//       item1.isDisabled = true; // 假设你想添加的字段是age
//     }
//   })
//   console.log(state.optionsCollegesList,'state.optionsCollegesList');
//   const currentOptions = state.optionsCollegesList.filter(item => 
//     selectList.includes(item.id)
//   );
//   if(!defaultStatus.value) {
//     currentOptions.forEach(option => {
//       const existItem = state.collegesTableData.find(item => item.id === option.id);
//       if (!existItem) {
//         if(defaultValue.value) {
//           state.collegesTableData.unshift({
//             id: option.id,
//             name: option.name,
//             GPA:defaultValue.value
//           });
//         }else {
//           state.collegesTableData.unshift({
//             id: option.id,
//             name: option.name,
//             GPA:0
//           });
//         }
//       }else {
//         state.collegesTableData = currentOptions
//       }
//     });
//   }else {
//     state.collegesTableData = []
//     selectList.forEach(item => {
//       state.cloneCollegesList.forEach(item1 => {
//         if(item == item1.id) {
//           state.collegesTableData.unshift({
//             id: item1.id,
//             name: item1.name,
//             GPA:0,
//           })
//         }
//       })
//     })
//   }
// })
// 获取国内学校数据
function getCollegesList () {
  loading.value = true
  schoolSearchName.value = null
  return new Promise(function(resolve,reject){  
    API.majorList.getCollegesList({}, (res) => {
      loading.value = false
      if(res.code == 0) {
        if(res.data.length > 0) {
          res.data.forEach(item => {
            item.isDisabled = null
          })
        }
        // state.optionsCollegesList = res.data
        state.cloneCollegesList =res.data
        resolve()
      }
    })
  })
}
// function getCollegesListn92 () {
//   loading.value = true
//   schoolSearchName.value = null
//   return new Promise(function(resolve,reject){  
//     API.majorList.getCollegesList({}, (res) => {
//       loading.value = false
//       if(res.code == 0) {
//         if(res.data.length > 0) {
//           res.data.forEach(item => {
//             item.isDisabled = null
//           })
//         }
//         // state.optionsCollegesList = res.data
//         state.cloneCollegesList =res.data
//         resolve()
//       }
//     })
//   })
// }
const deleteRow = ((index, rows) => {
  if(state.timeTableData.length > 1) {
    rows.splice(index, 1)
  }else {
    ElMessage.warning('已经是最后一条了哦')
  }
})
const addRow = ((index, rows) => {
  rows.push({month:null,startTime:null,endTime:null})
})
const changecheckedAll = ((val) => {
  if(!val) {
    state.collegesTableData.forEach((item,index) => {
      if(item.id === 0) {
        delete state.collegesTableData[index]
      }
    })
  }
})
// 获取区域支持的货币集接口
const getCurrencies = ((val) => {
  API.majorList.getCurrencies({area_id:val}, (res) => {
    if(res.code == 0) {
      state.currencyData = res.data
      if(props.parmas.type === 'add') {
        formData.currency_code = res.data.details[0].currency_code
      }
    }
  })
})
onMounted(async() => {
  // console.log(props.parmas,'props.parmas');
  // getTemplateList(props.parmas.itemInfo.colleges_id)
  gettagsList()
  if(props.parmas.type === 'update') {
    formData = reactive( {
      is_postgraduate:props.parmas.itemInfo.is_postgraduate,
      tags:props.parmas.itemInfo.tags,
      GMAT:props.parmas.itemInfo.GMAT,
      GRE:props.parmas.itemInfo.GRE,
      PTE:props.parmas.itemInfo.PTE,
      IELTS:props.parmas.itemInfo.IELTS,
      TOEFL:props.parmas.itemInfo.TOEFL,
      NEMT:props.parmas.itemInfo.NEMT,
      IELTS_TOTAL:props.parmas.itemInfo.IELTS_TOTAL,
      background:props.parmas.itemInfo.background,
      experience:props.parmas.itemInfo.experience,
      fee:props.parmas.itemInfo.fee,
      interview_written_test:props.parmas.itemInfo.interview_written_test,
      intro:props.parmas.itemInfo.intro,
      language:props.parmas.itemInfo.language,
      len_schooling:props.parmas.itemInfo.len_schooling,
      multi_neighbors:props.parmas.itemInfo.multi_neighbors,
      name:props.parmas.itemInfo.name,
      name_zh:props.parmas.itemInfo.name_zh,
      special:props.parmas.itemInfo.special,
      uk_rank:props.parmas.itemInfo.uk_rank,
      works:props.parmas.itemInfo.works,
      currency_code:props.parmas.itemInfo.currency_code,
      average_score:props.parmas.itemInfo.average_score,
      minimum_entry_grade:props.parmas.itemInfo.minimum_entry_grade,
      bridging_course:props.parmas.itemInfo.bridging_course,
      note:props.parmas.itemInfo.note,
      entrance_month:props.parmas.itemInfo.entrance_month,
      link:props.parmas.itemInfo.link,
      gpa_max:props.parmas.itemInfo.gpa_max,
      gpa_min:props.parmas.itemInfo.gpa_min,
    })
    entrance_month.value = (props.parmas.itemInfo.entrance_month.split(',')).map(Number),
    showItem.value = formData.is_postgraduate === 1 ? false : true
    if(props.parmas.itemInfo.average_score) {
      foundationCourse.value = 1
    }
    if(props.parmas.itemInfo.is_postgraduate === 0 && props.parmas.itemInfo.NEMT === 0) {
      radioNEMT.value = 0
    }else {
      radioNEMT.value = 1
    }
    // typeName.value = props.parmas.itemInfo.is_postgraduate === 1 ? 'GPA' : '高考分数'
    if(props.parmas.itemInfo.uk_rank === 0) {
      formData.uk_rank = null
    }
    // 入学月份
    if(props.parmas.itemInfo.apply_time.length > 0) {
      state.timeTableData = []
      props.parmas.itemInfo.apply_time.forEach((item) => {
        state.timeTableData.push({month:item[0],startTime:item[1],endTime:item[2]})
      })
    }
    // await getCollegesList()
    // 接收国内大学
    if(props.parmas.itemInfo.domestic_colleges.length > 0) {
      state.collegesListDate = []
      state.collegesTableData = []
      props.parmas.itemInfo.domestic_colleges.forEach((item,index) => {
        if(item.domestic_colleges_id === 0) {
          checkedAllValue.value = true
          checkedValue.value = item.degrees_GPA
        }else {
          state.collegesListDate.push(item.domestic_colleges_id)
          state.cloneCollegesList.forEach((citem,e) => {
            if(item.domestic_colleges_id === citem.id) {
              state.collegesTableData.push({
                id: item.domestic_colleges_id,
                name: citem.name,
                GPA:item.degrees_GPA
              })
            }
          })
          state.selectSchoolList = state.collegesTableData
        }
      })
    }
  } else {
    // getCollegesList()
  }
  getCurrencies(props.parmas.itemInfo.areas_id)
})
const emits = defineEmits(['closeAddSchool']);
// 提交学校数据
const majorloading = ref(false)
function onsubmit(type) {
  if(type === 1) {   //提交
    let message = (formData.is_postgraduate === 0 && radioNEMT.value === 1 && formData.NEMT < 1 && '请输入高考分数')
            || (foundationCourse.value == 1 && formData.is_postgraduate === 1 && !formData.average_score) && '请输入录取要求平均分'
            || (foundationCourse.value == 1 && formData.is_postgraduate === 0 && !formData.average_score) && '请输入高中平均分'
            || (foundationCourse.value == 1 && formData.is_postgraduate === 0 && !formData.minimum_entry_grade) && '请输入最低入学年级'
            || !formData.name && '请输入专业名称' 
            || !formData.name_zh && '请输入专业英文名称'
            // || !formData.intro && '请输入专业介绍'
            || !formData.background && '请输入背景要求'
            || entrance_month.value.length < 1 && '请选择入学月份'
            || formData.fee <= 0 && '学费金额必须大于0'
            || formData.tags.length < 1 && '请选择标签' || null;
            // || !formData.IELTS && '请输入雅思小分要求'
            // || !formData.IELTS_TOTAL && '请输入雅思分数'
            // || (formData.is_postgraduate === 1 && foundationCourse.value == 0 && state.collegesListDate.length < 1 && !checkedAllValue.value) && '接收国内的大学和接收国内所有大学至少要选择一个进行填写' || null;
    if(message)  return ElMessage.warning(message)
    majorloading.value = true
    // 高考分数
    if(formData.is_postgraduate === 0 && radioNEMT.value === 0) {
      formData.NEMT = 0
    }
    // 平均分和最低入学年级
    if(foundationCourse.value === 0) {   //是否为预科课程---否
      formData.average_score = null
      formData.minimum_entry_grade = null
      formData.bridging_course = null
    }
    // 1.国内学校数据处理
    // state.collegesTableData.forEach(item => {
    //   delete item.name
    // })
    // if(checkedAllValue.value) {  //选中所有
    //   if(checkedValue.value > 0) {
    //     state.collegesTableData.unshift({id:0,GPA:checkedValue.value})
    //     state.collegesTableData[0].GPA = checkedValue.value
    //   }else {
    //     return ElMessage.warning(`接收国内所有大学${typeName.value}设置要大于0哦!`)
    //   }
    // }
    // console.log(state.collegesTableData,'state.collegesTableData');
    // if(formData.is_postgraduate === 1 && foundationCourse.value === 0) {    //硕士并且预科课程为否
    //   formData.domestic_colleges = state.collegesTableData
    // }else {   //本科
    //   formData.domestic_colleges = []
    // }
    // 2.入学时间数据处理
    let timeArray = []
    state.timeTableData.forEach(obj => {
      let innerArray = Object.values(obj);
      timeArray.push(innerArray);
    });
    formData.apply_time = timeArray
    // 入学月份
    formData.entrance_month = entrance_month.value.join(',')
    if(props.parmas.type === 'add') {
      // 新增
      API.majorList.addDegreeMajor({...formData,departments_id:props.parmas.itemInfo.departments_id}, (res) => {
        majorloading.value = false
        if(res.code == 0) {
          emits('closeAddSchool',type)
          ElMessage.success ('新增成功')
        }else {
          ElMessage.warning('新增失败')
        }
      })
    }else {   
      //修改
      API.majorList.updateDegreeMajor({...formData,id:props.parmas.itemInfo.id,departments_id:props.parmas.itemInfo.departments_id}, (res) => {
        majorloading.value = false
        if(res.code == 0) {
          emits('closeAddSchool',type)
          ElMessage.success ('修改成功')
        }else {
          ElMessage.warning('修改失败')
        }
      })
    }
  }else {  //取消
    emits('closeAddSchool',type)
  }
}
// 获取后台模板列表
function getTemplateList (id) {
  loading.value = true
  API.schoolList.getTemplateData({colleges_id:id}, (res) => {
    loading.value = false
    if(res.code == 0) {
      state.templateOptions = res.data
    }
  })
}
// 选择模板
function changeTemplate(val) {
  getConfigTemplateColleges(val)
}
// 获取某个模板下的大学数据
function getConfigTemplateColleges(id) {
  API.schoolList.getConfigTemplateColleges({templates_id:id}, (res) => {
    loading.value = false
    if(res.code == 0) {
      state.collegesListDate = []
      state.collegesTableData = []
      res.data.forEach((item,index) => {
        state.collegesListDate.push(item.domestic_colleges_id)
        state.cloneCollegesList.forEach((citem,e) => {
          if(item.domestic_colleges_id === citem.id) {
            state.collegesTableData.push({
              id: item.domestic_colleges_id,
              name: citem.name,
              GPA:item.degrees_GPA
            })
          }
        })
      })
      state.selectSchoolList = state.collegesTableData
    }
  })
}
let batchCollegesVisible = ref(false)
let selectedFile = ref(null)
const batchImport = (() => {
  batchCollegesVisible.value = true
})
const handleFileChange = (event) => {
  selectedFile.value = event.target.files[0];
};
let batchloading = ref(false)
let errorMessageVisible = ref(false)
let failList = ref([])
async function uploadFile() {
  if(!selectedFile.value) {
    return ElMessage.warning('请选择要上传的excel文件')
  }
  const formData = new FormData();
  formData.append('file', selectedFile.value);
  batchloading.value = true
  try {
    const response = await axios.post(serverUrl+'/admin/degree/upload-gpa', formData, {
      headers: {
        'Content-Type': 'multipart/form-data',
        'token-admin': localStorage.getItem('token'),
      }
    });
    if(response.data.code === 0) {
      batchloading.value = false
      if(response.data.data.success.length > 0) {
        ElMessage.success(response.data.data.success.length + '条数据导入成功')
      }
      batchCollegesVisible.value = false
      configTemplateValue.value = null
      state.collegesListDate = []
      state.collegesTableData = response.data.data.success
      response.data.data.success.forEach((item,index) => {
        state.collegesListDate.push(item.id)
      })
      state.selectSchoolList = state.collegesTableData
      if(response.data.data.fail.length > 0) {
        errorMessageVisible.value = true
        failList.value = response.data.data.fail
        // let messageInfo = response.data.data.fail.join(',')
        // ElMessageBox({
        //   confirmButtonText: '确定',
        //   title: '提示',
        //   message: h('p', null, [
        //     h('span', null, '您有 '),
        //     h('i', { style: 'color: red' }, `${response.data.data.fail.length}`),
        //     h('span', null, ' 条数据(见下表)导入失败,请确认大学名称或GPA分数填写是否正确:'),
        //     h('p', { style: 'color: red' }, `${messageInfo}`),
        //   ]),
        //   showCancelButton:false,
        //   type: 'warning',
        // }).then(() => {}).catch(() => {});
      }
    }
    if(response.data.code === 401) {
      ElMessage.warning('未登录')
      router.push({path: '/'})
      localStorage.removeItem('token')
      localStorage.removeItem('operationStatus')
    }
  } catch (error) {
    batchloading.value = false
  }
}
</script> 

<style lang="scss" scoped>
::v-deep .el-tag__content {
  color: #409eff !important;
}
.view-main-table-upload {
  margin-bottom: 20px;
  text-align: start;
}
.add-major {
  max-height: 60vh;
  overflow: auto;
  padding-right: 15px;
  .add-major-checked {
    display: flex;
    .el-input-number {
      margin-left: 10px;
    }
  }
  .add-major-button {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 5px;
  }
  .add-major-add {
    font-size: 14px;
    color: rgb(68, 179, 206);
    padding-right: 5px;
    cursor: pointer;
  }
  .add-major-del {
    // padding: 0 5px;
    cursor: pointer;
    font-size: 13px;
    color: rgb(209, 64, 64);
  }
  .add-major-unit {
    position: absolute;
    right: 8px;
  }
}
.add-major-school {
  // height: 220px;
  // overflow: hidden;
  .major-school-type {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
  }
  .major-school-loading {
    height: 200px;
  }
  .checkbox-view {
    height: 290px;
    overflow: auto;
  }
  .input-with-button {
    color: #fff;
    background: #409eff;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }
  .add-major-title {
    // text-align: center;
    // font-size: 24px;
    // margin-top: 80px;
    .major-title1 {
      font-weight: 600;
    }
    .major-title2 {
      color: #409eff;
    }
  }
  .add-major-gpa {
    display: flex;
    margin: 10px 10px 10px 0;
    align-items: center;
    .el-input-number {
      width: 100%;
      margin-right: 10px;
    }
    .major-gpa-title {
      font-size: 12px;
      margin-left: 5px;
      color: rgb(230, 162, 60);
    }
  }
  .add-major-allcheckbox {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 30%;
  }
}
</style>